import cv2
import numpy as np

img1 =cv2.imread("9\\6.bmp")

kernel1=np.ones((2,3),np.uint8)

erosion1=cv2.erode(img1,kernel1)
erosion2=cv2.dilate(img1,kernel1)
erosion=erosion2-erosion1
cv2.imshow("img1",img1)
cv2.imshow("erosion",erosion)

cv2.waitKey()
cv2.destroyAllWindows()